package com.canqiang.template;

import java.util.List;

import com.canqiang.docadvice.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class DealTitleAdapter extends ArrayAdapter<DealTitle>{
	private LayoutInflater mInflater;
	public DealTitleAdapter(Context context, int textViewResourceId,
			List<DealTitle> objects) {
		super(context, textViewResourceId, objects);
		// TODO Auto-generated constructor stub
		this.mInflater = LayoutInflater.from(context);
	}
	@Override  
    public View getView(int position, View convertView, ViewGroup parent) {
		if(convertView == null){ 
			convertView= mInflater.inflate(R.layout.dealtitleview,null);
		}
		DTholder holder=null;
		DealTitle deal=getItem(position);
		if(holder==null){
			holder=new DTholder();
			holder.title=(TextView) convertView.findViewById(R.tpl.dealtitle);
			convertView.setTag(holder);
		}
		else{
			holder=(DTholder)convertView.getTag();
		}
		holder.title.setText(deal.getUser()+"|"+deal.getName());
		return convertView;
	}
	private static class DTholder{
		TextView title;
	}

}
